

class TestMem : public BindableObject
{
public:
	TestMem()
	{
		this->addProperty("number", &number);
		this->addProperty("text", &text);
	}
	
	Bound<int> number;
	Bound<std::string> text;
};


TEST(MemoryManagement, Referencing)
{
	Bind::R<TestMem> ref = new TestMem();
	
	ASSERT_TRUE(ref->refCount() == 1);
	
	{
		Bind::R<TestMem> ref2 = ref;
		
		ASSERT_TRUE(ref->refCount() == 2);		
	}
	
	int count = ref->refCount();
	ASSERT_TRUE(count == 1);
	
	ref.unset();
	
	ASSERT_TRUE(*ref == NULL);
	
	
}